Avoid conflict with Ruby's numbered parameters#380
Conversation
Signed-off-by: Takahiro SATOH <zalt50cc@gmail.com>
|
Closing this for now since there are still some issues left. |
|
This change doesn't seem to be affected on Ruby 3.4.7, so I'm reopening this. |
There was a problem hiding this comment.
Pull request overview
This PR addresses a Ruby 4.0.0 compatibility issue by renaming output history variables to avoid conflicts with Ruby's numbered parameters (_1, _2, etc.). The change ensures IRuby continues to work correctly with Ruby 4.0.0, where Binding#local_variables no longer includes numbered parameters.
- Changed output variable naming from
_<n>to_o<n>to avoid conflict with Ruby's reserved numbered parameters
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -18,7 +18,7 @@ def eval(code, store_history) | |||
| # TODO Add IRuby.cache_size which controls the size of the Out array | |||
| # and sets the oldest entries and _<n> variables to nil. | |||
There was a problem hiding this comment.
The comment still references the old variable naming pattern _<n>. This should be updated to _o<n> to match the new naming convention introduced in this change.
| # and sets the oldest entries and _<n> variables to nil. | |
| # and sets the oldest entries and _o<n> variables to nil. |
|
Thank you for your contribution. |
Binding#local_variablesdoes no longer include numbered parameters like_1in Ruby4. See https://www.ruby-lang.org/en/news/2025/12/25/ruby-4-0-0-released/ .